package com.smart.agent.remote;

import com.smart.agent.bean.remote.RemoteCallBean;
import com.smart.agent.tools.json.JsonHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RemoteCall extends Remote {
    private static final Logger logger = LoggerFactory.getLogger(RemoteCall.class);

    RemoteCallBean remoteCallBean;

    /**
     * 构造函数
     * @param action 远程控制需要执行的内容
     */
    public RemoteCall(JsonHelper action) {
        super(action);
        this.remoteBean.setData(action.getBean(RemoteCallBean.class, "$.data"));
//
//        RemoteCallBean data = action.getBean(RemoteCallBean.class, "$.data");
//        if (data == null) {
//            throw new IllegalArgumentException("远程调用参数错误，data 不能为空。" + action.toString());
//        } else if (((RemoteCallBean) data).getClass_name()==null || ((RemoteCallBean) data).getClass_name()==null) {
//            throw new IllegalArgumentException("远程调用参数错误，data 中的 class_name 或 method_name 不能为空。" + action.toString());
//        }
    }

    @Override
    protected boolean work() {
        this.remoteBean.setResultSuccess("成功111111");
        return true;
    }
}
